#include <iostream>

using namespace std;

int main()
{
    int n, i = 0, Arr[1000] = {0};
    cin >> n;
    while (n!=1)
    {
        Arr[i++] = n;
        if(n & 1) n = 3 * n + 1;
        else n >>= 1;
    }
    Arr[i]=1;
    for (int j = i; j >= 0; j--)
    {
        printf("%d", Arr[j]);
        if (j)
            putchar(' ');
    }

    return 0;
}
